#ifndef USER_H
#define USER_H

#include <string>

enum State
{
    onLine,
    offLine
};

// 通过User 展示业务层封装底层数据库的操作
/**
 * 例如：数据库中的User table内有四个字段:id、name、 password、 state
 * 配置User表的ORM（对象关系映射）类
 */
class User
{
public:
    User(int id = -1, std::string name = "", std::string pwd = "", std::string state = "offline")
        : _id(id), _name(name), _password(pwd), _state(state) {}

    // 设置字段
    void setId(const int id) { _id = id; };
    void setName(const std::string name) { _name = name; };
    void setPwd(const std::string pwd) { _password = pwd; };
    void setState(const std::string state) { _state = state; };

    // 获取字段
    const int getId() const { return _id; };
    const std::string getName() const { return _name; };
    const std::string getPwd() const { return _password; };
    const std::string getState() const { return _state; };

private:
    int _id;
    std::string _name;
    std::string _password;
    std::string _state;
};

#endif
